package com.sl.au.service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.data.domain.Sort.Direction;

import com.sl.au.entity.EventRegister;
import com.sl.au.entity.EventRegisterAndTaskView;
import com.sl.au.entity.EventRegisterTask;
import com.sl.au.entity.EventReport;
import com.sl.au.entity.EventTask;
import com.sl.au.entity.EventToEvaluateUser;
import com.sl.au.entity.Option;
import com.sl.au.entity.UserSingle;
import com.sl.au.entity.User;
import com.sl.au.repository.EventRegisterRepository;
import com.sl.au.repository.EventTaskRepository;
import com.sl.au.repository.EventToEvaluateUserRepository;
import com.sl.au.repository.ViewForEventRegisterTaskRepository;
import com.sl.au.entity.ViewForEventRegisterTask;

public interface EventRegisterService extends BaseService {

	ViewForEventRegisterTask getEventRegisterTaskByOpt(String opt,String id);
	
	EventRegisterRepository getRepository();

	EventTaskRepository getTaskRepository();

	EventToEvaluateUserRepository getEventToEvaluateUserRepository();

	List<EventRegister> getPage(int start, int length, String key, String orderName, Direction dir);

	List<EventRegister> getPageByEventReport(int start, int length, String eventReport, String key, String orderName,
			Direction dir);

	List<EventRegister> getPageByStateAndUser(int start, int length, String state, String user, String key,
			String orderName, Direction dir);

	int getCount(String key);

	int getCountByEventReport(String eventReport, String key);

	int getCountByStateAndUser(String state, String user, String key);

	List<List<UserSingle>> findUserSingle(String levelId, String eventType, String gridId);

	List<List<UserSingle>> findUserSingleByIdentify(String eventRegisterIdentify);

	List<EventRegister> initPageByStateId(int pageNow, int pageSize, String optionId);

	List<EventRegister> initArchievedEventReg(int pageNow, int pageSize, String optionId);

	void saveAll(EventRegister eventRegister, EventTask eventRegisterTask,
			List<EventToEvaluateUser> eventToEvaluateUser, EventReport eventReport, EventTask eventReportTask);

	List<EventRegister> findByReportId(String reportId);

	String submitEventRegister(String id, User user);

	String backEventRegister(String id, String backMemo, User user);

	String rejectEventRegister(String id, String rejectMemo, User user, String photoUrl);

	String rejectBackEventRegister(String id, String rejectBackMemo, User user);

	String reveiveEventRegister(String id, User user);

	EventTask getRejectBackReason(String id);

	List<EventRegister> getRegistersPageByReportId(String reportId, int start, int length);

	int getRegistersCountByReportId(String reportId);

	List<EventRegister> getPageByStateAndGrid(int start, int length, String state, String user, String key,
			String orderName, Direction dir);

	int getCountByStateAndGrid(String state, String user, String key);

	int getCountByTaskStateAndOperateUser(String state, String user, String key);

	List<ViewForEventRegisterTask> getPageByTaskStateAndOperate(int start, int length, String state, String user,
			String key, String orderName, Direction dir);

	List<EventRegister> getPageByEventReportAndType(int start, int length, String eventReport, String key, String type,
			String orderName, Direction dir);

	int getCountByEventReportAndType(String eventReport, String type, String key);

	List<EventRegister> getPageAndType(int start, int length, String key, String type, String orderName, Direction dir);

	int getCountAndType(String key, String type);

	List<EventRegister> getRegisterUserAndType(int start, int length, String userId, String type, String orderName,
			Direction dir);

	List<EventRegisterAndTaskView> findPageByReportAndType(int start, int length, String eventReport, String key,
			String type, String orderName, Direction dir);
	
	List<EventRegisterTask> findPageByReportAndType2(int start, int length, String eventReport, String key,
			String type, String orderName, Direction dir);
	
	List<EventRegisterTask> findPageByReportAndType3(int start, int length, String roleId, String eventReport, String key,
			String type, String orderName, Direction dir);

	int findCountByReportAndType(String eventReport, String key, String type);

	int findCountByReportAndType3(String roleId, String eventReport, String key, String type);

	List<EventRegisterAndTaskView> findPageAndType(int start, int length, String key, String type, String string,
			Direction desc);

	List<EventRegisterTask> findPageAndType2(int start, int length, String key, String type, String string,
			Direction desc);
	
	List<EventRegisterTask> findPageAndType3(int start, int length, String roleId, String key, String type, String string,
			Direction desc);

	int findCountAndType(String key, String type);

	int findCountAndType3(String roleId,String key, String type);

	List<EventRegisterAndTaskView> findUnderTimeoutEventByKey(int start, int length, String key, Option type);

	int findCountUnderTimeoutEventByKey(String key, Option type);

	List<EventRegisterAndTaskView> findUnderTimeoutEvent(int start, int length, Option type);

	int findCountUnderTimeoutEvent(Option type);
	
	List<EventRegisterAndTaskView> findUnderTimeoutEventNew(int start, int length, String key, double limit, Option type);

	int findCountUnderTimeoutEventNew(String key, double limit, Option type);

	EventTask findTask(String registerId, Option registerEventState);
	
	List<Map<String, Object>> getPageByTaskStateAndOperateAndRole(int start, int length, String roleId, String state, String user,String key, String orderName, String dir);
	
	int getCountByTaskStateAndOperateUserAndRole(String role,String state, String user, String key);
	
	List<Map<String,Object>> findUnderTimeoutEventByRole(int start, int length, String roleId, String key, double limit, Option type, String orderName, String dir);

	int findCountUnderTimeoutEventByRole(String roleId, String key, double limit, Option type);
	
	
	int findCountUnderTimeoutEventByRole(String roleId, Option type);
	
	List<EventRegister> getPageByEventDate(int start, int length, Date begin, Date end, String orderName, Direction dir);
	
	int getCountByEventDate(Date begin, Date end);
	
}
